package com.shujia.jichu

import scala.io.Source

/**
 *  隐式转换类
 */
object Demo25implicit {
  def main(args: Array[String]): Unit = {

//    val demo1 = new Demo12("scala/data/students.txt")
//    val stuList: List[String] = demo1.show1()


//    val stuList: List[String] = "scala/data/students.txt".show1()
//    val scoreList: List[String] = "scala/data/scores.txt".show1()

    "易政".f()




  }

  //`implicit' modifier cannot be used for top-level objects
  //implicit class Demo12(path: String) {
  //implicit使用的地方，不能超过object作用域
  implicit class Demo12(path: String) {
    def show1(): List[String] = {
      Source.fromFile(path).getLines().toList
    }

    def f()={
      println(s"好好学习，天天向上！$path")
    }
  }
}




